<?php

class image{
/*
*This method builds the line for an image:
*<li class="photo"><a rel="[gall1]" href="big_picture"><img src="thumb_big_picrure" width="200px" height="150px"/></a></li>
*
*/

	//Propreties
	private $fullImagePath;
	private $isSelectable;

	//Methods
	public function __construct($newImagePath,$selectable)
	{
		$this->fullImagePath = $newImagePath;
		$this->isSelectable = $selectable;
	}

	public function printImage($width, $height)
	{
		$toReturn = "";
		$smallImagePath = $this->getSmallImagePath();
		$toReturn .='<img class="pictureToComment" src="'.$smallImagePath.'"'.($width != ''? 'width="'.$width.'"':'').($height != ''? 'height="'.$height.'"':'').'/>';
		
		return $toReturn;
	}

	public function getSmallImagePath()
	{
		return $this->fullImagePath;
	}
	public function getImagePath()
	{
		//For Flickr
		if(strpos($this->fullImagePath, "staticflickr.com") === false){
			return $this->fullImagePath;
		}else
		{
			return str_replace("_s", "" , $this->fullImagePath);
		}
	}
	
		public function getLargeImagePath()
	{
		//For Flickr
		if(strpos($this->fullImagePath, "staticflickr.com") === false){
			return $this->fullImagePath;
		}else
		{
			$prefix = substr($this->fullImagePath, 0, strpos($this->fullImagePath, ".jpg"));
			return $prefix . '_b.jpg';
		}
	}
}
?>